<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
  <link rel="stylesheet" href="../book.css" charset="ISO-8859-1" type="text/css" />
  <title>Source Code Annotation</title>
</head>

<body>

<h2>Source Code Annotation</h2>

<p>
  Line coverage and branch coverage of the active coverage
  <a href="sessions.html">session</a> is also directly displayed in the Java
  source editors. This works for Java source files contained in the project as
  well as source code attached to binary libraries.
</p>

<p>
  <img src="images/annotations.png" alt="Annotations"/>
</p>

<p>
  Source lines containing executable code get the following color code:
</p>

<ul>
  <li>green for fully covered lines,</li>
  <li>yellow for partly covered lines (some instructions or branches missed) and</li>
  <li>red for lines that have not been executed at all.</li>
</ul>

<p>
  In addition colored diamonds are shown at the left for lines containing
  decision branches. The colors for the diamonds have a similar semantic
  than the line highlighting colors:
</p>

<ul>
  <li>green for fully covered branches,</li>
  <li>yellow for partly covered branches and</li>
  <li>red when no branches in the particular line have been executed.</li>
</ul>

<p>
  These default colors can be modified in the <i>Preferences</i> dialog
  (see next section). The source annotations automatically disappear when you
  start editing a source file or delete the coverage session.
</p>

<h3>Highlighting Preferences</h3>

<p>
  The Eclipse <a href="preferences.html">preferences</a> section
  <i>General &rarr; Appearance &rarr; Editors &rarr; Text Editors &rarr; Annotations</i>
  allows to modify the visual representation of coverage highlighting. The
  corresponding entries are:
</p>

<ul>
  <li>Full Coverage</li>
  <li>Partial Coverage</li>
  <li>No Coverage</li>
</ul>

<h3>Remarks about Line Coverage</h3>

<p>
  In some situations it is not obvious, why particular lines do have highlighting
  or have a particular color. The reason is that the underlying code coverage
  library JaCoCo works on Java class files only. In some cases the Java compiler
  creates extra byte code for a particular line of source code. Such situations
  might be filtered by future versions of JaCoCo and EclEmma.
</p>

</body>
</html>
